//
//  ViewController.m
//  HKGuidePageManager
//
//  Created by 胡锦涛 on 2019/2/27.
//  Copyright © 2019 胡锦涛. All rights reserved.
//

#import "ViewController.h"
#import "HKGuidePageManager.h"
@interface ViewController ()

@end

@implementation ViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    // 创建控件
    [self setupUI];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    // 引导视图
    [self showGuidePage];
}

- (void)setupUI
{
    // 底图
    UIImageView *imgView = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    imgView.image = [UIImage imageNamed:@"backImg"];
    imgView.contentMode = UIViewContentModeScaleAspectFill;
    [self.view addSubview:imgView];
}

- (void)showGuidePage
{
    // 判断是否已显示过
    if (![[NSUserDefaults standardUserDefaults] boolForKey:HKGuidePageHomeKey]) {
        // 显示
        [[HKGuidePageManager shareManager] showGuidePageWithType:HKGuidePageTypeHome completion:^{
            [[HKGuidePageManager shareManager] showGuidePageWithType:HKGuidePageTypeMajor];
        }];
    }
}
@end
